import React, { useEffect, useState } from 'react';
import { Space, Table, Tag } from 'antd';
import type { ColumnsType } from 'antd/es/table';
import { getChatlist } from '@/api/getToutist';
// import './style/tour.css';
import { addTable } from '@/pages/hoc/table.js';

interface DataType {
  key: string;
  name: string;
  age: number;
  address: string;
  tags: string[];
}

const columns: ColumnsType<DataType> = [
  {
    title: 'ID',
    dataIndex: 'log_id',
    key: 'log_id',
  },
  {
    title: '发送人',
    dataIndex: 'from_name',
    key: 'from_name',
  },
  {
    title: '消息',
    dataIndex: 'message',
    key: 'message',
  },

  {
    title: '接收人',
    dataIndex: 'to_name',
    key: 'to_name',
    render: (item) => {
      return item ? item : '无';
    },
  },
  {
    title: '创建时间',
    dataIndex: 'create_time',
    key: 'create_time',
  },
];

const Chat = (props: any) => {
  // console.log(props);
  let { data, count } = props;
  return (
    <Table
      pagination={{
        total: count,
        pageSize: 10,
        showQuickJumper: true,
      }}
      columns={columns}
      dataSource={data}
    ></Table>
  );
};

export default addTable(getChatlist)(Chat);
